﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using FluentScheduler;
using System.Threading.Tasks;
using YiYiTong.Rocket.Helper;
using YiYiTong.Rocket.Business;

namespace YiYiTong.Rocket.ProcessConsole
{
    /// <summary>
    /// 平台费用结算
    /// </summary>
    public class OrderSettlementJob : BaseJob
    {
        public override void DoAction()
        {
            string str = RedisService.PopItemFromList(RedisKeys.OrderSettlementKey);
            if (!string.IsNullOrEmpty(str))
            {
                //处理消息
                SortedDictionary<string, object> dic = JsonHelper.DeserializeLower(str);
                long orderid = dic.GetValue<long>("orderid");

                var result = OrderBiz.Instance.OrderSettlementWrite(orderid);
                if (!result.Item1)
                    LogHelper.Error("平台费用写入失败，原因：" + result.Item2);
            }
        }
    }
}
